#ifndef MYVIDEOPRODUCER_H
#define MYVIDEOPRODUCER_H

#include <QObject>
#include <QVideoSurfaceFormat>
#include <QAbstractVideoSurface>

class MyVideoProducer : public QObject
  {
      Q_OBJECT
      Q_PROPERTY(QAbstractVideoSurface *videoSurface READ videoSurface WRITE setVideoSurface)

  public:
      QAbstractVideoSurface* videoSurface() const { return m_surface; }

      void setVideoSurface(QAbstractVideoSurface *surface)
      {
//          if (m_surface != surface && m_surface && m_surface->isActive()) {
//              m_surface->stop();
//          }
          m_surface = surface;
//          if (m_surface)
//              m_surface->start(m_format);
      }

      // ...

//  public slots:
//      void onNewVideoContentReceived(const QVideoFrame &frame)
//      {
//          if (m_surface)
//              m_surface->present(frame);
//      }

  private:
      QAbstractVideoSurface *m_surface;
      QVideoSurfaceFormat m_format;
  };

#endif // MYVIDEOPRODUCER_H
